﻿/* Write a program to convert binary numbers to their decimal representation. */

using System;

class BinaryToDecimal
{
    static void Main()
    {
        Console.Write("Please provide the binary number you want to convert:");
        string binary_n = Console.ReadLine();

        int number = 0;
        for (int i = 0; i < binary_n.Length; i++)
        {
            if (binary_n[binary_n.Length - i - 1] == '0')
            {
                continue;
            }
            number += (int)Math.Pow(2, i);
        }
        Console.WriteLine("Binary: {0}\r\nDecimal: {1}", binary_n, number);
    }
}
